Output colored text in the shell using the echo commandNameecho-Displays a line of textProfileecho [Options] ... [String] ...DescribeOutputs a string to the standard output.-N does not output line breaks-E Open backslash ESC escape-e Suppress
First, familiarize yourself with the echo command
NameEcho-display a line of text
SummaryEcho [Option]... [String]...
DescriptionOutputs a string to the standard output.
-N does not output line breaks
-E open the backslash (ESC) Escape
-E cancel the
echo Display in shell script with color display, echo display with color, need to use parameters-The e format is as follows: The copy code code is as follows: Echo-E"\033[Word background color; text color m string \033[0m"For example, copy the code
The echo display in the shell script is displayed in color with the echo displayed in color with the parameter-EThe format is as follows:
Copy Code code as follows:
Echo-e "\033[character background color; text color m string \033[0m"
echo Display in shell script with color display, echo display with color, need to use parameter-EThe format is as follows:Echo-e "\033[word background color; text color m string \033[0m"Example: Echo-e "\033[41;36m something here \033[0m"Where 41 of
echo to change the color, use the parameter-eformat: echo-e "\033[word background color; font Color m string \033[0m"For example:echo-e "\033[41;36m something here \033[0m"Where 41 of the position represents the background, 36 of the position is the
When Echo needs to change the color, use the-e parameter.Format: ECHO-e "\ 033 [background color; font color M string \ 033 [0 m"For example:Echo-e "\ 033 [41; 36 m something here \ 033 [0 m"
The position 41 represents the background color, and the
When echo outputs the color, use the echo-e format: echo-e \ 033 [background color; Font color m, for example, echo-e \ 033 [32; in the above command, \ 033 [32; 40 m indicates defining the color of the subsequent text, \ 033 indicates starting an
Let echo output color characters: Echo Display in shell script color display, echo display with color, need to use parameter-e \033 can be replaced \e format as follows: Echo-e "\033[word background color; text color m string \033[0m" Example:
Read a lot of Chinese blog posts, most of the article is about the use of echo color, I really do not love to die, trace back, really look at the escape sequence is what?Escape characters, children who have studied C are aware that some control
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.